Skip to contentSkip to conversation

Multiple Openvpn servers using same port + Nginx

Openvpn-devel Daniel Lando 4 participants 6 messages Sep 30, 2022 – Oct 1, 2022

lore
Share & tools
lore
#0 lore raw

Hi everyone,

As described in this
<https://github.com/OpenVPN/openvpn/pull/166#issuecomment-1263600751>
comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container.

The possible solutions I have in mind could be by using subdomains or sni but cannot find a way to make them working as sni support is only available on openvpn 3.

There is also a webserver that should share the same port

Any suggestions? Thanks in advance

Signature · 2 lines
-- 
*Daniel Lando*
#1 lore raw

there's brilliant piece of software:
https://github.com/StreisandEffect/streisand

among other ideas, there's openvpn port sharing.

пт, 30 сент. 2022 г. в 20:22, Daniel Lando <[email protected]...>:

Quoted 25 lines

Hi everyone,

As described in this
<https://github.com/OpenVPN/openvpn/pull/166#issuecomment-1263600751>
comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container.

The possible solutions I have in mind could be by using subdomains or sni but cannot find a way to make them working as sni support is only available on openvpn 3.

There is also a webserver that should share the same port

Any suggestions? Thanks in advance

--
--
*Daniel Lando*
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#2 lore raw

Seems the project is unmaintained BTW.
Any other suggestions?

---
Daniel
On 1 Oct 2022, at 06:07, Илья Шипицин <[email protected]...> wrote:

there's brilliant piece of software: https://github.com/StreisandEffect/streisand
among other ideas, there's openvpn port sharing.
пт, 30 сент. 2022 г. в 20:22, Daniel Lando <[email protected]...>:
Hi everyone,
As described in this comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container. The possible solutions I have in mind could be by using subdomains or sni but cannot find a way to make them working as sni support is only available on openvpn 3.
There is also a webserver that should share the same port
Any suggestions? Thanks in advance
--
-- Daniel Lando _______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#3 lore raw

I apologise for suggesting unmaintaned project.

сб, 1 окт. 2022 г. в 14:43, Daniel Lando <[email protected]...>:

Quoted 44 lines

Seems the project is unmaintained BTW.

Any other suggestions?

---

*Daniel*

On 1 Oct 2022, at 06:07, Илья Шипицин <[email protected]...> wrote:


there's brilliant piece of software:
https://github.com/StreisandEffect/streisand

among other ideas, there's openvpn port sharing.

пт, 30 сент. 2022 г. в 20:22, Daniel Lando <[email protected]...>:

Quoted 25 lines

Hi everyone,

As described in this
<https://github.com/OpenVPN/openvpn/pull/166#issuecomment-1263600751>
comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container.

The possible solutions I have in mind could be by using subdomains or sni but cannot find a way to make them working as sni support is only available on openvpn 3.

There is also a webserver that should share the same port

Any suggestions? Thanks in advance

--
--
*Daniel Lando*
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#4 lore raw
In reply to Daniel Lando

Am 30.09.22 um 17:20 schrieb Daniel Lando:

Quoted 3 lines

Hi everyone,

As described in this <https://github.com/OpenVPN/openvpn/pull/166#issuecomment-1263600751> comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container.

OpenVPN does not use plain TLS over TCP like HTTPS does. Instead it uses its own framing that ngix will not understand. So you would need first of all a module for nginx that understand openvpn protocol framing.

While a custom proxy could work for that if you had SNI, that is something that would first need to be developed and also you would need client support for SNI. So far that has been little interest in that, so nobody made any advances in that area.

Also in OpenVPN we normally do not implement a feature that cannot be used. E.g. just implementing SNI client support without any available server implementation, is something that will get rejected.

Quoted 2 lines

The possible solutions I have in mind could be by using subdomains or sni but cannot find a way to make them working as sni support is only available on openvpn 3.

Even in OpenVPN 3 that feature is not used to my knowledge as there is no server support implemented anywhere as far as I can tell.

Quoted 2 lines

There is also a webserver that should share the same port

We already have port-share.

Arne

#5 lore raw
In reply to Daniel Lando

Hi,

Quoted 6 lines · Daniel Lando

As described in this
<https://github.com/OpenVPN/openvpn/pull/166#issuecomment-1263600751>
comment, what I would like to know is if it's possible (and how) I could proxy requests using nginx to multiple openvpn servers. I'm actually using docker-compose to start the openvpn servers and also nginx is running in a docker container.

If you are willing to live with openvpn over TCP, it might work by using OpenVPN's --http-proxy feature - it will do a TCP connect to nginx (or whatever) and then issue a CONNECT <targetip>:<port> command, and then speak OpenVPN wire protocol inside that TCP connection.

OTOH, using TCP is generally suboptimal performance-wise. If this is just for simple remote access, it's good enough, but if you want maximum throughput (especially if there might be packet loss), go for UDP.

A *real* solution would be, of course, to use IPv6, and have distinct IPv6 addresses for each container - so, do not go through a proxy, but have directly reachable endpoints.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...